package com.av.bcacc.jetpack.modle.viewmodel;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

public class CounterModel extends ViewModel {

    private MutableLiveData<Integer> currentCounter;


    public LiveData<Integer> getCurrentCounter() {
        if (currentCounter == null) {
            currentCounter=new MutableLiveData<>();
            currentCounter.setValue(0);
        }
        return currentCounter;
    }

    public void addCurrenCounter(int addValue){
        currentCounter.setValue(currentCounter.getValue()+addValue);
    }

    @Override
    protected void onCleared() {
        super.onCleared();
    }
}
